<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增交易量奖励配置')" />
    <th:block th:include="include :: datetimepicker-css" />
        <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-transactionReward-add">
            <div class="form-group">
                <label class="col-sm-3 control-label  is-required">服务商编号：</label>
                <div class="col-sm-8">
                    <input name="agentNum"  readonly id="xagentNum" type="text" class="form-control" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">服务商名称：</label>
                <div class="col-sm-8">
                    <input name="agentName" onclick="selectAgent()" class="form-control" id="xagentName" type="text" required readonly>
                    <i class="fa fa-search" style="margin-top: -22px;margin-right:3px;float:right;"></i>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">奖励类型：</label>
                <div class="col-sm-8">
                    <select onchange="showChange(this)" name="type" class="form-control m-b" th:with="type=${@dict.getType('pay_award_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group" id="posShow" style="display: none">
                <label class="col-sm-3 control-label">终端数考核月标准：</label>
                <div class="col-sm-8">
                    <input name="terminalStandard" class="form-control" placeholder="请输入终端数量" type="text">
                </div>
            </div>
            <div class="form-group" id="payShow">
                <label class="col-sm-3 control-label">月交易量返现比率：</label>
                <div class="col-sm-8">
                    <input name="cashbackRatio" class="form-control" placeholder="请输入奖励比例" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">奖励状态：</label>
                <div class="col-sm-8">
                    <select name="status" class="form-control m-b" th:with="type=${@dict.getType('pay_award_status')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">交易量考核月标准 ：</label>
                <div class="col-sm-8">
                    <input name="tradingStandard" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "transactionReward"
        $("#form-transactionReward-add").validate({
            focusCleanup: true
        });

        $("input[name='date']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/adds", $('#form-transactionReward-add').serialize());
            }
        }

        $("input[name='updateDateTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='createDateTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        function showChange(obj) {
            if (obj.value == '2'){
                $("#posShow").show();
                $("#payShow").hide();
            } else {
                $("#posShow").hide();
                $("#payShow").show();
            }
        }


        function selectAgent() {
            var prefix = ctx + "terminal/record"
            var url =prefix+ "/selectAgentInfo";
            $.modal.open("选择服务商" , url, '1000',"600");
        }
        
        function selectRewardActive() {
            var url =prefix+ "/selectRewardActive";
            $.modal.open("选择活动" , url, '1000',"600");
        }
    </script>
</body>
</html>